import useToast from "@/hooks/useToast";
function handleCopyListener(evt) {
  const text = evt.target.dataset.v_copy_text;
  navigator.clipboard.writeText(text).then(() => {
    useToast("复制成功");
  });
}
export default {
  mounted(el: HTMLElement, binding) {
    el.dataset.v_copy_text = binding.value;
    el.addEventListener("click", handleCopyListener);
  },
  updated(el: HTMLElement, binding) {
    el.dataset.v_copy_text = binding.value;
  },
  unmounted(el: HTMLElement, binding) {
    el.removeEventListener("click", handleCopyListener);
  }
};
